﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ContentList.ascx.cs" Inherits="RealState.W.AdminControl.ContentList" %>
 
<div class="grid_12">
    <div class="box">
        <h2>
            Danh sách bài đăng
        </h2>
        <div class="block">
            <div class="block_in">
             <table class="display" id="categoriesTable">
                    <thead>
                        <tr>
                            <th>
                                Mã
                            </th>
                            
                            <th>
                                Tiêu đề
                            </th>
                            <th>
                                Danh mục
                            </th>
                             <th>
                                Thời gian
                            </th>
                            <th>
                                Trạng thái
                            </th>
                            <th>
                                
                            </th>
                            <th>
                                Hiển thị
                            </th>
                            <th>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater ID="rptCategories" runat="server" 
                            onitemcommand="rptCategories_ItemCommand" 
                            onitemdatabound="rptCategories_ItemDataBound">
                            <ItemTemplate>
                                <tr class="gradeX">
                                    <td class="center">
                                        <%# Eval("CODE")%>
                                    </td>                                 
                                    <td>
                                    <%# Eval("TITLE")%>
                                        <asp:HiddenField ID="hdnSecID" Value='<%#Eval("ID") %>' runat="server" />
                                    </td>
                                     <td>
                                        <%# Eval("CategoriesName")%>
                                    </td>
                                     <td>
                                        <%# GetDatetime(Eval("CreatedTime"))%>
                                    </td>
                                      <td>
                                        <%# GetStatus(Eval("IsActive")) %>
                                    </td>
                                    <td>
                                       <%# GetSpecial(Eval("IsSpecial")) %>
                                    </td>
                                    <td class="center">
                                        <asp:Button ID="Button2" CssClass="button lightblue" runat="server" CommandName="status" />
                                        <asp:HiddenField ID="hdStatus" Value='<%#Eval("IsActive") %>' runat="server" />   
                                     <%-- <asp:CheckBox ID="cbEnabler" runat="server" AutoPostBack="true" OnCheckedChanged="check_changed" Checked='<%# Convert.ToBoolean(Eval("IsActive")) ? true : false %>' />--%>
                                    </td>
                                    <td>
                                        <asp:Button ID="Button1" CssClass="button blue" runat="server" Text="Chi tiết" CommandName="detail" />
                                    </td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
                
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <div>                 
                               <asp:GridView ID="GridView1" runat="server" 
                                        Width="940px"  HorizontalAlign="Center"
                                        OnRowCommand="GridView1_RowCommand" 
                                        AutoGenerateColumns="false" AllowPaging="false"
                                        DataKeyNames="ID">
                                <Columns>
                                   <asp:ButtonField CommandName="detail" 
                                         ControlStyle-CssClass="btn btn-info" ButtonType="Button" 
                                         Text="Detail" HeaderText="Chi tiết">
                                       <ControlStyle CssClass="btn btn-info" />
                                    </asp:ButtonField>
                                    <asp:BoundField DataField="RowNum" HeaderText="STT" />
                                    <asp:BoundField DataField="TITLE" HeaderText="Tiêu đề" />
                                    <asp:BoundField DataField="CategoriesName" HeaderText="Danh mục" />
                                    <asp:BoundField DataField="CreatedTime" DataFormatString="{0:MM/dd/yyyy}" HeaderText="Thời gian" />
                                    <asp:TemplateField HeaderText="Trạng thái">
                                        <ItemTemplate><%# (Boolean.Parse(Eval("IsActive").ToString())) ? "Hiện" : "Ẩn"%></ItemTemplate>
                                    </asp:TemplateField>
                               </Columns>
                               </asp:GridView>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    
                    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                        <ProgressTemplate>                           
                        <img src="" alt="Đang xử lý .....!"/>
                        </ProgressTemplate>
                    </asp:UpdateProgress>
                    
                    <div id="currentdetail" class="modal hider fade" 
                       tabindex=-1 role="dialog" aria-labelledby="myModalLabel" 
                       aria-hidden="true">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" 
                                  aria-hidden="true">×</button>
                            <h3 id="myModalLabel">Chi tiết</h3>
                       </div>
                        <div class="modal-body">
                       <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                        <ContentTemplate>
                                <asp:DetailsView ID="DetailsView1" runat="server" 
                                          CssClass="table table-bordered table-hover" 
                                           BackColor="White" ForeColor="Black"
                                           FieldHeaderStyle-Wrap="false" 
                                           FieldHeaderStyle-Font-Bold="true"  
                                           FieldHeaderStyle-BackColor="LavenderBlush" 
                                           FieldHeaderStyle-ForeColor="Black"
                                           BorderStyle="Groove" AutoGenerateRows="False">
                                    <Fields>
                             <asp:BoundField DataField="Title" HeaderText="Tiêu đề" />
                             <asp:BoundField DataField="Content" HeaderText="Nội dung" />
                                   </Fields>
                              </asp:DetailsView>
                      </ContentTemplate>
                       <Triggers>
                           <asp:AsyncPostBackTrigger ControlID="rptCategories"  EventName="ItemCommand" />  
                       </Triggers>
               </asp:UpdatePanel>
                        <div class="modal-footer">
                        <button class="btn btn-info" data-dismiss="modal" 
                                aria-hidden="true">Đóng</button>
                    </div>
                </div>
                    </div>
            </div>
        </div>
    </div>
</div>
<!-- End of .grid_12 -->
<div class="clear">
</div>